package cn.fl.ass.controller;


import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.cmm.base.framework.utils.DecimalUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.ass.service.IAssTrailCarChannelService;
import cn.fl.ass.vo.AssTrailCarChannelVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysRegionService;
import cn.fl.system.service.ISysUlFilesRecService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.ass.facade.condition.AssTrailCarChannelQC;
import fl.ass.facade.constant.AssTrailCarChannelConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Description: 拖车渠道表 控制层
 */
@Controller
@RequestMapping("/ass/assTrailCarChannel")
public class AssTrailCarChannelController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(AssTrailCarChannelController.class);

	/**
	 * AssTrailCarChannel 服务层BEAN
	 */
	@Autowired
	private IAssTrailCarChannelService assTrailCarChannelService;
    /**
     * SysRegion 服务层BEAN
     */
    @Autowired
    private ISysRegionService sysRegionService;
    /**
     * 附件服务
     */
    @Autowired
    private ISysUlFilesRecService sysUlFilesRecService;
	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("ass/assTrailCarChn/assTrailCarChnInfoList");
        List<KeyValueVO> provinceKVList = this.sysRegionService.searchProvinceKVList();
        KeyValueVO keyValueVO = new KeyValueVO();
        keyValueVO.setKey("ALL");
        keyValueVO.setValue("总部");
        provinceKVList.add(0, keyValueVO);
        view.addObject("provinceKVList", provinceKVList);
		return view;
	}

    /**
     * 到新增页面
     */
    @RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("ass/assTrailCarChn/assTrailCarChnInfoAdd");
        List<KeyValueVO> cstTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.CODE_GRP_CST_TYP_CD);
        List<KeyValueVO> coopTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.TRAIL_CAR_CHN_COOP_TYP);
        List<KeyValueVO> provinceKVList = this.sysRegionService.searchProvinceKVList();
        KeyValueVO keyValueVO = new KeyValueVO();
        keyValueVO.setKey("ALL");
        keyValueVO.setValue("总部");
        provinceKVList.add(0, keyValueVO);

        view.addObject("cstTypCdList", cstTypCdList);
        view.addObject("provinceKVList", provinceKVList);
        view.addObject("coopTypCdListJson", "[{\"key\":\"ALL\",\"value\":\"全部\",\"children\":" + JSON.toJSONString(coopTypCdList) + "}]");
        view.addObject("provinceKVListJson", "[{\"key\":\"ALL\",\"value\":\"全国\",\"children\":" + JSON.toJSONString(provinceKVList) + "}]");

        return view;
    }

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		ModelAndView view = new ModelAndView("ass/assTrailCarChn/assTrailCarChnInfoModify");
		view.addObject("id", id);
        //获取信息
        if(StringUtils.isNotEmpty(id)){
            AssTrailCarChannelVO assTrailCarChannelVO = this.assTrailCarChannelService.selectById(Long.valueOf(id));
            if (null != assTrailCarChannelVO && null != assTrailCarChannelVO.getRegCapAmt()) {
                assTrailCarChannelVO.setRegCapAmt(assTrailCarChannelVO.getRegCapAmt() / 100);
            }
            List<KeyValueVO> cstTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.CODE_GRP_CST_TYP_CD);
            List<KeyValueVO> coopTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.TRAIL_CAR_CHN_COOP_TYP);
            List<KeyValueVO> provinceKVList = this.sysRegionService.searchProvinceKVList();
            KeyValueVO keyValueVO = new KeyValueVO();
            keyValueVO.setKey("ALL");
            keyValueVO.setValue("总部");
            provinceKVList.add(0, keyValueVO);
            view.addObject("cstTypCdList", cstTypCdList);
            view.addObject("provinceKVList", provinceKVList);
            view.addObject("assTrailCarChannelVO", assTrailCarChannelVO);
            view.addObject("assTrailCarChannelVOJson", JSONObject.toJSONString(assTrailCarChannelVO));
            view.addObject("coopTypCdListJson", "[{\"key\":\"ALL\",\"value\":\"全部\",\"children\":" + JSON.toJSONString(coopTypCdList) + "}]");
            view.addObject("provinceKVListJson", "[{\"key\":\"ALL\",\"value\":\"全国\",\"children\":" + JSON.toJSONString(provinceKVList) + "}]");
        }
		return view;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String channelNm = request.getParameter("channelNm");//渠道名称
        String recordPrCd = request.getParameter("recordPrCd");//备案省Cd

        Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		AssTrailCarChannelQC qc = new AssTrailCarChannelQC();
		if (StringUtils.isNotEmpty(channelNm)) {
            qc.setChannelNm(channelNm.trim());
        }
        if (StringUtils.isNotEmpty(recordPrCd)) {
            qc.setRecordPrCd(recordPrCd);
        }
        qc.setIsDel(BaseConstant.IS_YESNO_NO);
		page.setCondition(qc);

		Pager pager = new Pager();
        pager = this.assTrailCarChannelService.searchListPage(page);
		List<AssTrailCarChannelVO> list = (List<AssTrailCarChannelVO>) pager.getResultList();
		ListPageVO<AssTrailCarChannelVO> listPage = new ListPageVO<AssTrailCarChannelVO>(list, pager.getTotalCount());
		return listPage;
	}

    /**
     * 启用 禁用 渠道
     */
    @RequestMapping(value = "/enable.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object enAbleChannel(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        String isValid = request.getParameter("isValid");//是否有效
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if(StringUtils.isEmpty(id)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            return result;
        }
        if(StringUtils.isEmpty(isValid)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_PARAM_IS_BAD);
            return result;
        }

        try {
            boolean success = this.assTrailCarChannelService.enAbleChannel(Long.valueOf(id), Integer.valueOf(isValid));
            if(!success){
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_ENABLE_FAIL);
            }
        }catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("启用或禁用拖车渠道失败 BaseException").setBussinessId(id).setThrowable(ex).info();
        }catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("启用或禁用拖车渠道失败 Exception").setBussinessId(id).setThrowable(ex).info();
        }
        return result;
    }

    /**
     * 根据省获取拖车单位名称
     * 下拉数据
     */
    @RequestMapping(value = "/getChnByPrCd.do", method = { RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public Object getChnByPrCd(HttpServletRequest request, HttpServletResponse response){
        String recordPrCd = request.getParameter("recordPrCd");
        String isVaildFlag = request.getParameter("isVaildFlag");//是否有效的标志

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        ListPageVO<AssTrailCarChannelVO> listPage = null;
        if(StringUtils.isEmpty(recordPrCd)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("省CD为空！");
            return result;
        }
        List<AssTrailCarChannelVO> assTrailCarChannelDTOS = new ArrayList<>();
        try{
            assTrailCarChannelDTOS = this.assTrailCarChannelService.getChnByPrCd(recordPrCd, isVaildFlag);
            listPage = new ListPageVO<AssTrailCarChannelVO>((List<AssTrailCarChannelVO>) assTrailCarChannelDTOS, assTrailCarChannelDTOS.size());
            result.setData(assTrailCarChannelDTOS);
        }catch(BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("根据省获取拖车单位名称失败 BaseException").setThrowable(ex).setKeys("recordPrCd:" + recordPrCd).info();
        }catch(Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("根据省获取拖车单位名称失败 Exception").setThrowable(ex).setKeys("recordPrCd:" + recordPrCd).info();
        }
        return listPage;
    }

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeById.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			this.assTrailCarChannelService.removeById(Long.valueOf(id));
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
		}

		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		
		try {
			AssTrailCarChannelVO vo = this.assTrailCarChannelService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
			}
			result.setData(vo);
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("获取拖车渠道记录失败 BaseException").setThrowable(ex).setBussinessId(id).info();
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("获取拖车渠道记录失败 Exception").setThrowable(ex).setBussinessId(id).info();
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String channelNm = request.getParameter("channelNm");//渠道名称
        String channelTypeCd = request.getParameter("channelTypeCd");//渠道类型
        String recordPrCd = request.getParameter("recordPrCd");//渠道备案省
        String succ = request.getParameter("succ");//社会统一信用代码
        String corpRep = request.getParameter("corpRep");//法人代表
        String idNo = request.getParameter("idNo");//身份证号
        String mp = request.getParameter("mp");//联系人手机号码
        String email = request.getParameter("email");//邮箱
        String regDt = request.getParameter("regDt");//成立日期
        String dailyAddr = request.getParameter("dailyAddr");//日常所在地
        String addr = request.getParameter("addr");//地址
        String regCapAmt = request.getParameter("regCapAmt");//注册资本
        String expDt = request.getParameter("expDt");//营业期限
        String coopTypCd = request.getParameter("coopTypCd");//合作模式
        String rgnCd = request.getParameter("rgnCd");//地区代码
        String recordInfo = request.getParameter("recordInfo");//备注

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		AssTrailCarChannelVO entity = null;
		try {
			entity = new AssTrailCarChannelVO();
            entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            entity.setCrtTm(new Date());
            entity.setIsDel(BaseConstant.IS_YESNO_NO);

            entity.setChannelNm(channelNm);
            entity.setChannelTypeCd(channelTypeCd);
            entity.setRecordPrCd(recordPrCd);
            entity.setSucc(succ);
            entity.setCorpRep(corpRep);
            entity.setIdNo(idNo);
            entity.setMp(mp);
            entity.setEmail(email);
            if(StringUtils.isNotEmpty(regDt)){
                entity.setRegDt(DateUtils.formatStringToDate(regDt, DateUtils.YYYY_MM_DD));
            }
            entity.setDailyAddr(dailyAddr);
            entity.setAddr(addr);
            if (StringUtils.isNotEmpty(regCapAmt)) {
                entity.setRegCapAmt(Double.valueOf(DecimalUtils.convertYuanToFen(Double.valueOf(regCapAmt))));
            }
            if(StringUtils.isNotEmpty(expDt)){
                entity.setExpDt(DateUtils.formatStringToDate(expDt, DateUtils.YYYY_MM_DD));
            }
            entity.setCoopTypCd(coopTypCd);
            entity.setRgnCd(rgnCd);
            entity.setRecordInfo(recordInfo);
            Long id = this.assTrailCarChannelService.add(entity);
            if (StringUtils.isNotEmpty(id)) {
                uploadAttchment(request, result, id);
            }
			result.setData(id);
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("新增拖车渠道失败 BaseException").setThrowable(ex).setKeys("entity:" + JSONObject.toJSONString(entity)).info();
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("新增拖车渠道失败 Exception").setThrowable(ex).setKeys("entity:" + JSONObject.toJSONString(entity)).info();
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
        String channelNm = request.getParameter("channelNm");//渠道名称
        String channelTypeCd = request.getParameter("channelTypeCd");//渠道类型
        String recordPrCd = request.getParameter("recordPrCd");//渠道备案省
        String succ = request.getParameter("succ");//社会统一信用代码
        String corpRep = request.getParameter("corpRep");//法人代表
        String idNo = request.getParameter("idNo");//身份证号
        String mp = request.getParameter("mp");//联系人手机号码
        String email = request.getParameter("email");//邮箱
        String regDt = request.getParameter("regDt");//成立日期
        String dailyAddr = request.getParameter("dailyAddr");//日常所在地
        String addr = request.getParameter("addr");//地址
        String regCapAmt = request.getParameter("regCapAmt");//注册资本
        String expDt = request.getParameter("expDt");//营业期限
        String coopTypCd = request.getParameter("coopTypCd");//合作模式
        String rgnCd = request.getParameter("rgnCd");//地区代码
        String recordInfo = request.getParameter("recordInfo");//备注
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		AssTrailCarChannelVO entity = null;
		try {
			entity = new AssTrailCarChannelVO();
            entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            entity.setMdfTm(new Date());

            entity.setId(Long.valueOf(id));
            entity.setChannelNm(channelNm);
            entity.setChannelTypeCd(channelTypeCd);
            entity.setRecordPrCd(recordPrCd);
            entity.setSucc(succ);
            entity.setCorpRep(corpRep);
            entity.setIdNo(idNo);
            entity.setMp(mp);
            entity.setEmail(email);
            if(StringUtils.isNotEmpty(regDt)){
                entity.setRegDt(DateUtils.formatStringToDate(regDt, DateUtils.YYYY_MM_DD));
            }
            entity.setDailyAddr(dailyAddr);
            entity.setAddr(addr);
            if (StringUtils.isNotEmpty(regCapAmt)) {
                entity.setRegCapAmt(Double.valueOf(regCapAmt) * 100);
            }
            if(StringUtils.isNotEmpty(expDt)){
                entity.setExpDt(DateUtils.formatStringToDate(expDt, DateUtils.YYYY_MM_DD));
            }
            entity.setCoopTypCd(coopTypCd);
            entity.setRgnCd(rgnCd);
            entity.setRecordInfo(recordInfo);
			boolean success = this.assTrailCarChannelService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				return result;
			}
            //处理附件
            this.uploadAttchment(request, result, Long.valueOf(id));
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("修改拖车渠道失败 BaseException").setBussinessId(id).setKeys("entity:" + JSONObject.toJSONString(entity)).setThrowable(ex).info();
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("修改拖车渠道失败 Exception").setBussinessId(id).setKeys("entity:" + JSONObject.toJSONString(entity)).setThrowable(ex).info();
		}
		return result;
	}

    /**
     * 到详细页面
     */
    @RequestMapping(value = "/toDetailPage.do", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toDetailPage(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        ModelAndView view = new ModelAndView("ass/assTrailCarChn/assTrailCarChnInfoDetail");
        view.addObject("id", id);
        //获取信息
        if(StringUtils.isNotEmpty(id)){
            AssTrailCarChannelVO assTrailCarChannelVO = this.assTrailCarChannelService.selectById(Long.valueOf(id));
            if (null != assTrailCarChannelVO && null != assTrailCarChannelVO.getRegCapAmt()) {
                assTrailCarChannelVO.setRegCapAmt(assTrailCarChannelVO.getRegCapAmt() / 100);
            }
            List<KeyValueVO> cstTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.CODE_GRP_CST_TYP_CD);
            List<KeyValueVO> coopTypCdList = this.assTrailCarChannelService.searchCdList(DictionaryConstant.TRAIL_CAR_CHN_COOP_TYP);
            List<KeyValueVO> provinceKVList = this.sysRegionService.searchProvinceKVList();
            KeyValueVO keyValueVO = new KeyValueVO();
            keyValueVO.setKey("ALL");
            keyValueVO.setValue("总部");
            provinceKVList.add(0, keyValueVO);
            view.addObject("cstTypCdList", cstTypCdList);
            view.addObject("provinceKVList", provinceKVList);
            view.addObject("assTrailCarChannelVO", assTrailCarChannelVO);
            view.addObject("assTrailCarChannelVOJson", JSONObject.toJSONString(assTrailCarChannelVO));
            view.addObject("coopTypCdListJson", "[{\"key\":\"ALL\",\"value\":\"全部\",\"children\":" + JSON.toJSONString(coopTypCdList) + "}]");
            view.addObject("provinceKVListJson", "[{\"key\":\"ALL\",\"value\":\"全国\",\"children\":" + JSON.toJSONString(provinceKVList) + "}]");
        }
        return view;
    }

    private void uploadAttchment(HttpServletRequest request, DataResultVO result, Long id) {
        String attchmnt = request.getParameter("fileParams");
        if(StringUtils.isNotEmpty(attchmnt)){
            //上传解析
            try{
                String cfgCd = AssTrailCarChannelConstant.ASS_TRAIL_CAR__CHN_CFGCD;
                String cfgDtlCd = AssTrailCarChannelConstant.ASS_TRAIL_CAR_CHN_CFGDTLCD_10;
                String tabNm = AssTrailCarChannelConstant.ASS_TRAIL_CAR_CHN;
                String cfgOrgCd = AssTrailCarChannelConstant.ASS_TRAIL_CAR_CHN_CFGORG;
                Boolean attchmntPass = this.sysUlFilesRecService.addAttchmnt(String.valueOf(id), attchmnt, cfgCd, cfgDtlCd, tabNm, "拖车渠道表附件!", null, null, false, cfgOrgCd);
                if(null == attchmntPass || attchmntPass == false){
                    result.setInfo(result.getInfo()+"-附件上传失败!");
                }
            }catch(Exception e){
                BaseLogUtils.newLogger("附件上传失败").setThrowable(e).setKeys("info:" + result.getInfo()).info();
                result.setInfo(result.getInfo()+"-附件上传失败!");
            }
        }
    }
}

